/**
 * Created by xukj on 2018/6/6.
 */
import React from 'react';
import PropTypes from 'prop-types';
import { View, Text, TouchableOpacity } from 'react-native';

const propTypes = {
  onPress: PropTypes.func,
  disabled: PropTypes.bool,
  style: Text.propTypes.style,
  containerStyle: View.propTypes.style,
  text: PropTypes.string,
  activeOpacity: PropTypes.number
};

const TextButton = ({
                  onPress,
                  disabled,
                  style,
                  containerStyle,
                  text,
                  activeOpacity
                }) => (
  <TouchableOpacity
    style={containerStyle}
    onPress={onPress}
    disabled={disabled}
    activeOpacity={activeOpacity}
  >
    <Text style={style}>{text}</Text>
  </TouchableOpacity>
);

TextButton.propTypes = propTypes;

TextButton.defaultProps = {
  onPress() {},
  disabled: false,
  activeOpacity: 0.8
};

export default TextButton;